# -*- coding: utf-8 -*-
# File: demo_metaclass.py
# Time: 2022/01/18 15:07:00
# Author: selfeasy
# Email: selfeasy@qq.com
# description: metaclass

import sys
from unicodedata import name

class MetaDemo(type):
    def __new__(cls, name, bases,attr):
        bases=(list,)
        print(cls)
        print(name)
        print(bases)
        print(attr)
        return super(MetaDemo, cls).__new__(cls,name, bases,attr)

'''py3
class A(object,metaclass = MetaDemo):
        name='selfeasy'
'''


class A(object):#py2
    __metaclass__ = MetaDemo
    name='selfeasy'

print(A.name)
print(A('selfeasy')) #继承自list，list('selfeasy')


'''
创建类的对象是元类，元类要么是type、要么是继承自type的子类
'''